/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
$(document).ready(index);

function index() {    
    $('#menuTicket').click({param1: "gestionTicket"}, changePage);
    $('#menuProblemas').click({param1: "gestionProblemas"}, changePage);
    $('#menuCambios').click({param1: "gestionCambios"}, changePage);
}

function changePage(event) {
    param1 = event.data.param1;
    $.ajax(
            {
                type: "GET",
                url: param1,
                async: false,
                dataType: "text",
                beforeSend: function() {

                },
                success: function(transport)
                {
                    $("#body-content").html(transport);
                },
                error: function(xhr, ajaxOptions, thrownError) {
                    $('#errores').html(xhr.responseText);
                    alert(thrownError);
                }
            });

    switch (param1) {
        case "gestionTicket":            
            $('input[id="btnVerTicket"]').click(verTicket);
            //$('input[id="btnEliminarTicket"]').click(eliminarTicket);        
            $('#btnAgregarTicket').click(agregarTicket);           
            break; 
        case "gestionProblemas":            
            $('input[id="btnSolucion"]').click(solucionarProblema);
            $('#btnBuscar').click(buscarProblemas);        
            break;      
        case "gestionCambios":            
            $('input[id="btnCambioComponente"]').click(cambioComponente);
            $('#btnBuscar').click(buscarCambiosComponente);        
            break;   
    }
}

